<div class="centercontent tables">
<div class="pageheader notab">
<h1 class="pagetitle">Modul Agenda</h1>
<span class="pagedesc">
<strong>Tambah data peminjaman barang, Nama Agenda : <?php echo $nama_agenda; ?>, Tanggal Pelaksanaan : <?php echo $tanggal_agenda; ?></strong>
</span> </div>
<!--pageheader-->
<div id="contentwrapper" class="contentwrapper"><br />
<div class="tombol_tambah" align="right">  
<button onclick="location.href='<?php echo base_url(); ?>index.php/peminjaman_barang/index/<?php echo $id_agenda; ?>'" class="stdbtn btn_orange"><< Kembali ke Daftar Peminjaman Barang</button>
</div>
<div class="contenttitle2">
<h3>Tambah Peminjaman Barang</h3>
</div>
<!--contenttitle-->

<form action="<?php echo base_url() ?>index.php/peminjaman_barang/edit_proses" method="post" class="quickform">	
	<div class="one_half">
		<input type="hidden" id="id_agenda" name="id_agenda" value="<?php echo $id_agenda; ?>"/>
		<input type="hidden" id="id_peminjaman_lama" name="id_peminjaman_lama" value="<?php echo $id_peminjaman; ?>"/>
        <p>
            <label for="title">Nama Barang</label>
            <span class="monthselect">
                <select name="barang" id="barang" style="opacity: 0;">
                  <option value="">Pilih Barang yang Dipinjam</option>
				  <?php foreach ($barang->result() as $row){ ?>
                  <option value="<?php echo $row->kode_barang; ?>" <?php if($row->kode_barang == $kode_barang) { echo 'selected'; } ?>><?php echo $row->kode_barang.'-'.$row->nama_barang.'('.$row->keterangan.')'; ?></option>
                  <?php } ?>
                </select>			
				<?php echo form_error('barang'); ?>
            </span>
        </p> 
        <p>
            <label for="date">Tanggal Pinjam</label>
            <input type="text" id="datepickfrom" name="tanggal_pinjam" value="<?php echo $tanggal_pinjam; ?>"/>&nbsp; &nbsp; 
			Jam : 
			<select name="jam_pinjam" id="jam_pinjam" style="opacity: 0;">
                <option value="">Pilih Jam</option>
				<?php 
				for($count = 1; $count <= 24; $count++){
				if($count < 10){
					$value_jam = '0'.$count;
				} else {
					$value_jam = $count;
				}
				?>
                <option value="<?php echo $value_jam ?>" <?php if($value_jam == $jam_pinjam) echo 'selected'; ?>><?php echo $value_jam ?></option>
				<?php } ?>
            </select>
			<input type="hidden" name="menit_pinjam" value="00" class="xsmall" />			
				<?php echo form_error('tanggal_pinjam'); ?>			
				<?php echo form_error('jam_pinjam'); ?>
        </p>
        <p>
            <label for="date">Tanggal Kembali</label>
            <input type="text" id="datepickto" name="tanggal_kembali" value="<?php echo $tanggal_kembali; ?>"/>&nbsp; &nbsp; 
			Jam :
			<select name="jam_kembali" id="jam_kembali" style="opacity: 0;">
                <option value="">Pilih Jam</option>
				<?php 
				for($count = 1; $count <= 24; $count++){
				if($count < 10){
					$value_jam = '0'.$count;
				} else {
					$value_jam = $count;
				}
				?>
                <option value="<?php echo $value_jam ?>" <?php if($value_jam == $jam_kembali) echo 'selected'; ?>><?php echo $value_jam ?></option>
				<?php } ?>
            </select>
			<input type="hidden" name="menit_kembali" value="00" class="xsmall" />	
				<?php echo form_error('tanggal_kembali'); ?>			
				<?php echo form_error('jam_kembali'); ?>
        </p>
		<p>
            <label for="date">Status Peminjaman</label>             
			<select name="status_peminjaman" id="status_peminjaman" style="opacity: 0;">
                <option value="">Pilih Status Peminjaman</option>
                <option value="Dibooking/dibawa" <?php if($status_peminjaman == 'Dibooking/dibawa') echo 'selected'; ?>>Dibooking/dibawa</option>
				<option value="Tidak Dipinjam" <?php if($status_peminjaman == 'Tidak Dipinjam') echo 'selected'; ?>>Tidak Dipinjam</option>
            </select>	
				<?php echo form_error('status_peminjaman'); ?>
        </p>
		<p>
            <label for="date">Status Kondisi Barang</label>             
			<select name="kondisi_barang" id="kondisi_barang" style="opacity: 0;">
                <option value="">Pilih Kondisi Barang</option>
                <option value="Rusak" <?php if($kondisi_barang == 'Rusak') echo 'selected'; ?>>Rusak</option>
				<option value="Baik" <?php if($kondisi_barang == 'Baik') echo 'selected'; ?>>Baik</option>
				<option value="Hilang" <?php if($kondisi_barang == 'Hilang') echo 'selected'; ?>>Hilang</option>
            </select>
				<?php echo form_error('kondisi_barang'); ?>
        </p>
        <br />     
    </div><!-- one_half -->
    
    <div class="one_half last">    	           
		<p>
        	<label>Keterangan</label>
            <textarea name="keterangan" id="keterangan" cols="" rows="6px"><?php echo $keterangan_peminjaman; ?></textarea>
        </p>
    </div><!-- one_half last -->
    
    <br clear="all" />
    
	<p class="stdformbutton">
		<button class="submit radius2" type="submit">Simpan Data</button>
        <input class="reset radius2" value="Reset" type="reset" />
    </p>
    </form>
	<!--overviewhead-->	<?php 
								if($list_peminjaman != ''){
								if($list_peminjaman->num_rows() > 0){
						?>
                        <br clear="all" />
                        <div class="widgetbox">
                            <div class="title">
                              <h3>Informasi peminjaman barang</h3>
                            </div>
                            <div class="widgetcontent">
                                <ul class="recent_list">                                    
								<?php 
								foreach($list_peminjaman->result() as $row){ ?>
                                    <li class="calendar new">
                                        <div class="msg"><strong>
                                            Agenda : <a href="<?php echo base_url().'index.php/agenda/detail_agenda/'.$row->id_agenda; ?>">
											<?php echo $row->nama_agenda; ?></a>, Waktu : <?php echo date('d F Y', strtotime($row->tanggal_mulai)).' ('.$row->jam_mulai.')'; ?> s.d. 
											<?php echo date('d F Y', strtotime($row->tanggal_selesai)).' ('.$row->jam_selesai.')'; ?>, 
											Status Agenda : <?php echo $row->status_agenda; ?>,  <br/>
											Waktu Peminjaman Barang : <?php echo date('d F Y', strtotime($row->tanggal_pinjam)).' ('.$row->jam_pinjam.')'; ?> s.d. 
											<?php echo date('d F Y', strtotime($row->tanggal_kembali)).' ('.$row->jam_kembali.')'; ?>.
											</strong>
                                        </div>
                                    </li>
								<?php } 
								?>									
                                </ul>
                            </div><!--widgetcontent-->
					</div>
					<?php } } ?>
<!--contenttitle--></div>
<!--contentwrapper--> </div>
<!-- centercontent -->